import javax.swing.*;

public class DemoCombo extends JPanel
{
  String planetas[] = {"Mercurio","Venus","Tierra","Marte","Jupiter","Saturno","Urano","Neptuno","Pluton"};

  public DemoCombo()
  {
    JComboBox combo1 = new JComboBox();
    JComboBox combo2 = new JComboBox();
    for (int i=0;i<planetas.length;i++)
    {
      combo1.addItem (planetas[i]);
      combo2.addItem (planetas[i]);
    }

    combo1.setSelectedIndex(-1);

	//Modifico el combo2 para que sea Editable
    combo2.setEditable(true);
    
    combo2.setSelectedItem(" ");
    
    //Nro de Filas visibles
    combo2.setMaximumRowCount(4);

    add(combo1);
    add(combo2);
  }

  public static void main(String args[])
  {
	  JFrame ventana=new JFrame("Demo Combo");
	  ventana.getContentPane().add(new DemoCombo());
	  ventana.setSize(300,100); 
	  ventana.setVisible(true);
	  ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

